package com.fc.mall.portal.controller;

import com.fc.mall.base.object.Result;
import com.fc.mall.model.SysPropertyConfig;
import com.fc.mall.portal.service.SysPropertyConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/sys")
@Api(tags = "SystemController", description = "系统通用接口")
public class SystemController {
    @Autowired
    private SysPropertyConfigService propertyConfigService;

    @ApiOperation("获取资质照片地址")
    @GetMapping(value = "/platformAptitude")
    public Result getPlatformAptitude()
    {
        return Result.success(propertyConfigService.getPlatformAptitude());
    }

    @ApiOperation("获取配置列表")
    @GetMapping("list")
    public Result list(@RequestParam Integer category)
    {
        List<SysPropertyConfig> propertyConfigs = propertyConfigService.getListByCatgory(category);
        return Result.success(propertyConfigs);
    }

    @ApiOperation("获取配置")
    @GetMapping("key/{key}")
    public Result getByKey(@PathVariable String key)
    {
        return Result.success(propertyConfigService.getSysConfigValueByKey(key));
    }
}
